package com.matt.controller.web.courseV2;

import com.matt.commons.dto.sso.StaffDTO;
import com.matt.commons.model.StatusResponse;
import com.matt.domain.courseV2.Fabulous;
import com.matt.domain.courseV2.po.CourseDetailsPO;
import com.matt.domain.courseV2.vo.FabulousVO;
import com.matt.foundation.model.MemVerificationCache;
import com.matt.foundation.utils.CopyUtils;
import com.matt.service.CommentsService;
import com.matt.service.courseV2.VendorFabulousService;
import com.matt.service.courseV2.VendorRecordService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

import static com.matt.foundation.constant.RequestConstant.TICKET;


@RestController
@RequestMapping("/api/vendor_fabulous")
@Slf4j
@Api(tags = "教学 - 点赞记录")
public class VendorFabulousController {

    @Autowired
    private VendorFabulousService vendorFabulousService;

    @Autowired
    private MemVerificationCache cache;

    @Autowired
    private CommentsService commentsService;

    @ApiOperation(value = "点赞 - 添加/取消点赞")
    @PostMapping("/add")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "ticket", value = "票据", required = true, dataType = "string")
    })
    public StatusResponse add(FabulousVO fabulous) {
        Fabulous fabulous1 = new Fabulous();
        CopyUtils.copyProperties(fabulous, fabulous1);
        vendorFabulousService.add(fabulous1);
        return StatusResponse.success("成功");
    }


    @ApiOperation(value = "点赞 - 列表集合")
    @PostMapping("/list")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "ticket", value = "票据", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 000000, message = "successful", response = CourseDetailsPO.class),
    })
    public StatusResponse list(String resId) {
        List<Fabulous> list = vendorFabulousService.resIdFindAll(resId);
        return StatusResponse.success(list);
    }
}
